package com.i2silly.wxbot.utils;


import java.sql.Timestamp;
import java.util.UUID;

/**
 * 基础报文类
 * 
 * @author kwufa@linewell.com
 * @date 2017年2月13日 上午9:24:57
 */
public class Message {

	/**
	 * 唯一标识符
	 */
	private String unid;

	/**
	 * 设备接入网关编号，消费程序编号
	 */
	private String msgDagNo;

	/**
	 * 报文名称：dag,device,mq,picserver,heart,update,command,<br>
	 * dagState,deviceState,picstoreState,programState,<br>
	 * faceCapture
	 */
	private String msgName;

	/**
	 * 报文操作类型：1-新增，2-修改，3-删除
	 */
	private String msgType;

	/**
	 * 报文操作时间
	 */
	private Timestamp msgDate;

	public String getUnid() {
		String uuid = UUID.randomUUID().toString().replace("-", "");
		return PubUtils.isEmpty(unid) ? uuid : unid;
	}

	public void setUnid(String unid) {
		this.unid = unid;
	}

	public String getMsgDagNo() {
		return msgDagNo;
	}

	public void setMsgDagNo(String msgDagNo) {
		this.msgDagNo = msgDagNo;
	}

	public String getMsgName() {
		return msgName;
	}

	public void setMsgName(String msgName) {
		this.msgName = msgName;
	}

	public String getMsgType() {
		return msgType;
	}

	public void setMsgType(String msgType) {
		this.msgType = msgType;
	}

	public Timestamp getMsgDate() {
		return msgDate == null ? new Timestamp(System.currentTimeMillis()) : msgDate;
	}

	public void setMsgDate(Timestamp msgDate) {
		this.msgDate = msgDate;
	}

}
